package ctrl;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import chat.single.MsgSing;
import chat.user.ChatMsg;
import chat.user.UserBean;


public class ChatMsgViewCtrl extends HttpServlet {
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf-8");
		resp.setCharacterEncoding("utf-8");
		String path = req.getContextPath();
		req.setAttribute("path", path);
		
		ArrayList list = MsgSing.getIns().getAllMsg();
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		
		req.setAttribute("list", list);
		req.setAttribute("sf", sf);
		req.getRequestDispatcher("/WEB-INF/page/ChatMsgView.jsp").forward(req, resp);
		//接收参数
	}

}
